package com.hyt.it.ogt.api.ykcj;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.domain.exchange.MessageInfo;
import com.hyt.it.ogt.ykcj.service.exchange.IApiLogService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ApiSort;
import lombok.extern.slf4j.Slf4j;

/**
 * description 对外接收推送考生考试信息的Controller
 *
 * @author yaojian
 * @createTime 2021/12/03
 */
@Api(tags = "API.13.对外考试消息接收接口", value = "接收考试考试消息推送的")
@ApiSort(value = 1003)
@Slf4j
@RestController
@RequestMapping("/exchange/exam/info")
public class ExamExamineeInfoApi extends BaseController {

    @Resource
    IApiLogService apiLogService;

    /**
     * 接收考试考试信息
     *
     * @throws Exception
     */
    @ApiOperation("13.1 保存考生考试信息")
    @ApiResponses(value = {@ApiResponse(code = 13000, message = "调用失败！"),})
    @PostMapping("/saveCandidateInfo")
    public AjaxResult saveCandidateInfo(@RequestBody MessageInfo messageInfo) {
        log.info("接收的数据对象json内容是:{}", JSON.toJSON(messageInfo));
        apiLogService.saveCandidateInfo(messageInfo);
        return AjaxResult.success();
    }
}
